
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
    .pagemar{
        margin: 20px 0;
    }
</style>
<div class="row">
    <div class="col-md-4">
        <nav aria-label="Page navigation">
            <ul class="pagination">
                <li>
                    <a href="javascript:jumpPage(1);" >
                        <span aria-hidden="true">首页</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:proPage();">上一页</a>
                </li>
                <li><a href="javascript:nextPage();">下一页</a></li>
                <li>
                    <a href="javascript:lastPage();">
                        <span aria-hidden="true">尾页</span>
                    </a>
                </li>

            </ul>
        </nav>
    </div>
    <div class="col-md-2 form-horizontal">
        <div class="form-group pagemar">
            <p class="form-control-static">当前第<span id="pageNum">1</span>页</p>
        </div>
    </div>
    <div class="col-md-3 form-inline">
        <div class="form-group pagemar">
            <label class="sr-only" for="pageSize">Amount (in dollars)</label>
            <div class="input-group">
                <div class="input-group-addon">每页</div>
                <select class="form-control" id="pageSize" onchange="query()">
                    <option >10</option>
                    <option >20</option>
                    <option >30</option>
                </select>
                <div class="input-group-addon">条</div>
            </div>
        </div>

    </div>
    <div class="col-md-2 form-horizontal">
        <div class="form-group pagemar">
            <p class="form-control-static">共<span id="totalNum"></span>条数据</p>
        </div>

    </div>
</div>
<script>

    function proPage() {
        var pageNum = parseInt($("#pageNum").text())-1;
        if (pageNum > 0){
            $("#pageNum").text(pageNum)
            query();
        }

    }

    function nextPage() {
        var pageNum = parseInt($("#pageNum").text())+1;
        if (pageNum <= totalPage){
            $("#pageNum").text(pageNum)
            query();
        }

    }
    function jumpPage(pageNum) {
        $("#pageNum").text(pageNum)
        query();
    }
    function lastPage() {
        //最后一页？
        $("#pageNum").text(totalPage)
        query();
    }
    var totalPage = 0;
    function pageData(page) {
        $("#pageNum").text(page.pageNum)
        $("#totalNum").text(page.totalNum)
        totalPage = page.totalPage
    }
</script>